<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Administration/main.master"
    CodeFile="ProductVariantDetails.aspx.cs" ValidateRequest="false" Inherits="Tathata.Web.Administration.Administration_ProductVariantDetails" %>

<%@ Register TagPrefix="nopCommerce" TagName="SelectDiscountsControl" Src="Modules/SelectDiscountsControl.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="Modules/NumericTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="DecimalTextBox" Src="Modules/DecimalTextBox.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="c1" ContentPlaceHolderID="cph1" runat="Server">
    <div>
        <table class="adminContent">
            <tr>
                <td class="adminTitle">
                    Product name:
                </td>
                <td class="adminData">
                    <asp:Label ID="lblProductName" runat="server"></asp:Label>
                    <asp:HyperLink runat="server" ID="hlProductURL" Text="See product"></asp:HyperLink>
                </td>
            </tr>
        </table>
        <ajaxToolkit:TabContainer runat="server" ID="ProductVariantTabs" ActiveTabIndex="0">
            <ajaxToolkit:TabPanel runat="server" ID="pnlProductVariantInfo" HeaderText="Product Variant Info">
                <ContentTemplate>
                    <table class="adminContent">
                        <tr>
                            <td class="adminTitle">
                                Name:
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtName" runat="server" CssClass="adminInput"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                SKU:
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtSKU" runat="server" CssClass="adminInput"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Image:
                            </td>
                            <td class="adminData">
                                <asp:Image ID="iProductVariantPicture" runat="server" />
                                <br />
                                <asp:Button ID="btnRemoveProductVariantImage" CssClass="adminButton" CausesValidation="false"
                                    runat="server" Text="Remove image" OnClick="btnRemoveProductVariantImage_Click"
                                    Visible="false" />
                                <br />
                                <asp:FileUpload ID="fuProductVariantPicture" CssClass="adminInput" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Description:
                            </td>
                            <td class="adminData">
                                <FCKeditorV2:FCKeditor ID="txtDescription" runat="server" BasePath="~/fckeditor/"
                                    AutoDetectLanguage="false" Height="350" Width="800px">
                                </FCKeditorV2:FCKeditor>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Admin comment:
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtAdminComment" runat="server" CssClass="adminInput" TextMode="MultiLine"
                                    Height="100"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Manufacturer part number:
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtManufacturerPartNumber" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Is download:
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="cbIsDownload" runat="server" Checked="False"></asp:CheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Download file (only zip files):
                            </td>
                            <td class="adminData">
                                <asp:HyperLink ID="hlProductVariantDownload" runat="server" Text="Download" />
                                <br />
                                <asp:Button ID="btnRemoveProductVariantDownload" CssClass="adminButton" CausesValidation="false"
                                    runat="server" Text="Remove download" OnClick="btnRemoveProductVariantDownload_Click"
                                    Visible="false" />
                                <br />
                                <asp:FileUpload ID="fuProductVariantDownload" CssClass="adminInput" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Is ship enabled:
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="cbIsShipEnabled" runat="server" Checked="True"></asp:CheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Is free shipping:
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="cbIsFreeShipping" runat="server" Checked="False"></asp:CheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Tax category:
                            </td>
                            <td class="adminData">
                                <asp:DropDownList ID="ddlTaxCategory" AutoPostBack="False" CssClass="adminInput"
                                    runat="server">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Stock quantity :
                            </td>
                            <td class="adminData">
                                <nopCommerce:NumericTextBox runat="server" ID="txtStockQuantity" CssClass="adminInput"
                                    RequiredErrorMessage="Enter stock quantity" Value="10000" MinimumValue="0" MaximumValue="999999"
                                    RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:NumericTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Warehouse:
                            </td>
                            <td class="adminData">
                                <asp:DropDownList ID="ddlWarehouse" AutoPostBack="False" CssClass="adminInput" runat="server">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Disable buy button
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="cbDisableBuyButton" runat="server" Checked="False"></asp:CheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Requires text option:
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="cbRequiresTextOption" runat="server" Checked="False"></asp:CheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Text option prompt:
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtTextOptionPrompt" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Price [<%=CurrencyManager.PrimaryStoreCurrency.CurrencyCode%>]:
                            </td>
                            <td class="adminData">
                                <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" ID="txtPrice" Value="0"
                                    RequiredErrorMessage="Price is required" MinimumValue="0" MaximumValue="999999"
                                    RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:DecimalTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Old price [<%=CurrencyManager.PrimaryStoreCurrency.CurrencyCode%>]:
                            </td>
                            <td class="adminData">
                                <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" ID="txtOldPrice"
                                    Value="0" RequiredErrorMessage="Old price is required" MinimumValue="0" MaximumValue="999999"
                                    RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:DecimalTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Weight [<%=MeasureWeightManager.BaseWeightIn.Name%>]:
                            </td>
                            <td class="adminData">
                                <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" ID="txtWeight" Value="0"
                                    RequiredErrorMessage="Weight is required" MinimumValue="0" MaximumValue="999999"
                                    RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:DecimalTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Length [<%=MeasureDimensionManager.BaseDimensionIn.Name%>]:
                            </td>
                            <td class="adminData">
                                <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" ID="txtLength" Value="0"
                                    RequiredErrorMessage="Length is required" MinimumValue="0" MaximumValue="999999"
                                    RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:DecimalTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Width [<%=MeasureDimensionManager.BaseDimensionIn.Name%>]:
                            </td>
                            <td class="adminData">
                                <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" ID="txtWidth" Value="0"
                                    RequiredErrorMessage="Width is required" MinimumValue="0" MaximumValue="999999"
                                    RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:DecimalTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Height [<%=MeasureDimensionManager.BaseDimensionIn.Name%>]:
                            </td>
                            <td class="adminData">
                                <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" ID="txtHeight" Value="0"
                                    RequiredErrorMessage="Height is required" MinimumValue="0" MaximumValue="999999"
                                    RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:DecimalTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Published:
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="cbPublished" runat="server" Checked="True"></asp:CheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Display order
                            </td>
                            <td class="adminData">
                                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtDisplayOrder"
                                    Value="1" RequiredErrorMessage="Display order is required" MinimumValue="-99999"
                                    MaximumValue="99999" RangeErrorMessage="The value must be from -99999 to 99999">
                                </nopCommerce:NumericTextBox>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
            <ajaxToolkit:TabPanel runat="server" ID="pnlProductAttributes" HeaderText="Product Variant Attributes">
                <ContentTemplate>
                    <table class="adminContent">
                        <tr>
                            <td colspan="2" width="100%">
                                <asp:GridView ID="gvProductVariantAttributes" runat="server" AutoGenerateColumns="false"
                                    DataKeyNames="ProductVariantAttributeID" OnRowDeleting="gvProductVariantAttributes_RowDeleting"
                                    OnRowDataBound="gvProductVariantAttributes_RowDataBound" OnRowCommand="gvProductVariantAttributes_RowCommand"
                                    Width="100%">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Attribute" ItemStyle-Width="30%">
                                            <ItemTemplate>
                                                <asp:DropDownList ID="ddlProductAttribute" runat="server" />
                                                <asp:HiddenField ID="hfProductVariantAttributeID" runat="server" Value='<%# Eval("ProductVariantAttributeID") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Is Required" ItemStyle-Width="10%">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="cbIsRequired" runat="server" Checked='<%# Eval("IsRequired") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtDisplayOrder"
                                                    Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="Display order is required"
                                                    RangeErrorMessage="The value must be from -99999 to 99999" ValidationGroup="ProductVariantAttribute"
                                                    MinimumValue="-99999" MaximumValue="99999"></nopCommerce:NumericTextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Values" ItemStyle-Width="20%">
                                            <ItemTemplate>
                                                <a href="ProductVariantAttributeValues.aspx?ProductVariantAttributeID=<%#Eval("ProductVariantAttributeID")%>">
                                                    View/Edit value (Total:
                                                    <%#((ProductVariantAttributeValueCollection)Eval("ProductVariantAttributeValues")).Count%>)
                                                </a>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Update" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
                                            ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:Button ID="btnUpdate" runat="server" CssClass="adminButton" Text="Update" ValidationGroup="ProductVariantAttribute"
                                                    CommandName="UpdateProductVariantAttribute" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
                                            ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:Button ID="btnDeleteProductVariantAttribute" runat="server" CssClass="adminButton"
                                                    Text="Delete" CausesValidation="false" CommandName="Delete" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                    <table class="adminContent">
                        <tr>
                            <td colspan="2">
                                <b>Adding new attribute</b>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Select attribute:
                            </td>
                            <td class="adminData">
                                <asp:DropDownList class="text" ID="ddlNewProductAttributes" AutoPostBack="False"
                                    CssClass="adminInput" runat="server">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Is required:
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="cbNewProductVariantAttributeIsRequired" runat="server" Checked="true" />
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                Display order:
                            </td>
                            <td class="adminData">
                                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtNewProductVariantAttributeDisplayOrder"
                                    Value="1" RequiredErrorMessage="Display order is required" RangeErrorMessage="The value must be from -99999 to 99999"
                                    MinimumValue="-99999" MaximumValue="99999" ValidationGroup="NewProductVariantAttribute">
                                </nopCommerce:NumericTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="left">
                                <asp:Button runat="server" ID="btnNewProductVariantAttribute" CssClass="adminButton"
                                    Text="Add attribute" ValidationGroup="NewProductVariantAttribute" OnClick="btnNewProductVariantAttribute_Click">
                                </asp:Button>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
            <ajaxToolkit:TabPanel runat="server" ID="pnlDiscountMappings" HeaderText="Discounts">
                <ContentTemplate>
                    <table class="adminContent">
                        <tr>
                            <td>
                                <nopCommerce:SelectDiscountsControl ID="DiscountMappingControl" runat="server" CssClass="adminInput">
                                </nopCommerce:SelectDiscountsControl>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
        </ajaxToolkit:TabContainer>
        <table class="adminContent">
            <tr>
                <td class="adminTitle" align="left">
                    <asp:Button ID="SaveButton" runat="server" CssClass="adminButton" Text="Save" OnClick="SaveButton_Click">
                    </asp:Button>
                </td>
                <td class="adminData" align="left">
                    <asp:Button ID="DeleteButton" runat="server" CssClass="adminButton" Text="Delete"
                        OnClick="DeleteButton_Click" CausesValidation="false"></asp:Button>
                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmDeleteButtonExtender" runat="server"
                        TargetControlID="DeleteButton" DisplayModalPopupID="ModalPopupExtenderDelete" />
                    <br />
                    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderDelete" runat="server" TargetControlID="DeleteButton"
                        PopupControlID="pnlDeletePopup" OkControlID="deleteButtonOk" CancelControlID="deleteButtonCancel"
                        BackgroundCssClass="modalBackground" />
                    <asp:Panel ID="pnlDeletePopup" runat="server" Style="display: none; width: 250px;
                        background-color: White; border-width: 2px; border-color: Black; border-style: solid;
                        padding: 20px;">
                        <div style="text-align: center;">
                            Are you sure?
                            <br />
                            <br />
                            <asp:Button ID="deleteButtonOk" runat="server" Text="OK" CssClass="adminButton" CausesValidation="false" />
                            <asp:Button ID="deleteButtonCancel" runat="server" Text="Cancel" CssClass="adminButton"
                                CausesValidation="false" />
                        </div>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
